home *** CD-ROM | disk | FTP | other *** search
- ; This program sets up a simple little protected mode handler for the timer
- ; IRQ 0. It just flashes a '0' then a '1' in the upper right corner of the
- ; screen.
-
- .386p
- code32 segment para public use32
- assume cs:code32, ds:code32
-
- include pmode.inc
-
- public _main
-
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- ; DATA
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
-
- irq_stub_buf db 21 dup(?) ; buffer for IRQ callback stub
-
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
- ; CODE
- ;±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
-
- ;ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕ
- _main:
- sti
-
- mov bl,0 ; get and store old IRQ 0 vector
- call _getirqvect
- push edx
- mov edx,offset pmirq0a ; set new IRQ 0 protected mode vector
- call _setirqvect
- mov edi,offset irq_stub_buf ; set real mode IRQ 0 callback
- call _rmpmirqset
- push eax ; store old real mode IRQ 0 address
-
- mov byte ptr gs:[0b8000h+158],' ' ; put space on screen
-
- mov v86r_ah,0 ; wait for key with INT 16h AH=0
- mov al,16h
- int 33h
-
- mov edx,offset pmirq0b ; set new protected mode IRQ 0
- call _setirqvect
- mov edi,offset irq_stub_buf ; update real mode callback
- call _rmpmirqset ; ignore the EAX passed back this
- ; time since its just the address
- ; of the old callback
-
- mov byte ptr gs:[0b8000h+158],' ' ; put space on screen
-
- mov v86r_ah,0 ; wait for key with INT 16h AH=0
- mov al,16h
- int 33h
-
- pop eax ; restore old real mode IRQ 0 vector
- call _rmpmirqfree
- pop edx ; restore old protected mode IRQ 0
- call _setirqvect ; vector, though you dont need to do
- ; this before exiting
-
- jmp _exit
-
- ;ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
- pmirq0a: ; I think these handlers are pretty self-explanatory
- push eax ds
- mov ds,cs:_selzero
- xor byte ptr ds:[0b8000h+158],' ' xor '0'
- pop ds
- mov al,20h
- out 20h,al
- pop eax
- sti
- iretd
-
- ;ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ
- pmirq0b:
- push eax ds
- mov ds,cs:_selzero
- xor byte ptr ds:[0b8000h+158],' ' xor '1'
- pop ds
- mov al,20h
- out 20h,al
- pop eax
- sti
- iretd
-
- code32 ends
- end
-
-